using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PietschSoft.VE;

namespace SecurityLinkUp
{
    public partial class CommunitySummaryCtrl : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void LoadInfo(Guid CommunityID)
        {    
            // clear the map
            Map.Pushpins.Clear();

            // get the community
            Community c = CommunityData.GetCommunity(CommunityID);

            // update the community info
            CommunityTitle.Text = c.name;
            CommunityDescription.Text = c.description;

            // get all the chapters for this community 
            ArrayList Chapters = ChapterData.GetChaptersFromCommunityID(CommunityID, CommonData.Status.ACTIVE);
            foreach (Chapter ch in Chapters)
            {
                if (ch.HasPosition)
                {
                    LatLong Position = new LatLong(ch.geolat, ch.geolong);
                    Pushpin p = new PietschSoft.VE.Pushpin(ch.uid.ToString(), Position, null, ch.name, "<a href=/ViewChapter.aspx?ChapterID=" + ch.uid.ToString() + ">Go to this chapter</a>");
                    Map.Pushpins.Add(p);
                }
            }
            
        }



            
    }
}